﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharacterController : MonoBehaviour
{
    [Header("Preparation")]
    public GameObject Anubis;
    public SIGGRAPH_Asia_2019 siggraph;
    public ProcessText processText;

    [Header("Character Controller")]
    public GameObject activeCharacter;
    public List<GameObject> characters;

    public void InitGameobjects()
    {
        // Get Anubis to add necessary components
        Anubis = GameObject.Find("Anubis");
        if (Anubis)
        {

        }
    }

    public void SetActiveChar()
    {
        activeCharacter.SetActive(true);
        foreach (var c in characters)
            if (!c.Equals(activeCharacter))
                c.SetActive(false);

        // set script component
        siggraph.animDriver = activeCharacter.GetComponent<BVHDriver>();
        processText.motionAvatar = activeCharacter.GetComponent<Animator>();
    }

    // Use this for initialization
    void Start()
    {
        activeCharacter.SetActive(true);
        foreach (var c in characters)
            if (!c.Equals(activeCharacter))
                c.SetActive(false);

        // set script component
        siggraph.animDriver = activeCharacter.GetComponent<BVHDriver>();
        processText.motionAvatar = activeCharacter.GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {

    }
}